From 38676ef718719666363fd7389fca9b9050f7210f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 18 Apr 2011 04:24:12 +0200 Subject: [PATCH] label: Request more natural size for ellipsizing wrapping labels --- gtk/gtklabel.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index f9abc0b256..0ef1f7f2e5 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -3487,6 +3487,7 @@ get_size_for_allocation (GtkLabel *label, gint *minimum_size, gint *natural_size) { + GtkLabelPrivate *priv = label->priv; PangoLayout *layout; gint text_height; @@ -3498,7 +3499,15 @@ get_size_for_allocation (GtkLabel *label, *minimum_size = text_height; if (natural_size) - *natural_size = text_height; + { + if (priv->ellipsize && priv->wrap) + { + layout = gtk_label_get_measuring_layout (label, layout, allocation * PANGO_SCALE, G_MAXINT); + pango_layout_get_pixel_size (layout, NULL, &text_height); + } + + *natural_size = text_height; + } g_object_unref (layout); } -- 2.30.2